<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OpenNebula Sunstone: Cloud Operations Center</title>

    <!--[if IE]><link rel="shortcut icon" href="images/favicon.ico"><![endif]-->
    <link rel="apple-touch-icon-precomposed" href="images/apple-touch-icon-precomposed.png">
    <link rel="icon" href="images/favicon.png">

    <% if session[:lang] %>
      <script src="locale/languages/<%= session[:lang] %>.js?v=<%= OpenNebula::VERSION %>" type="text/javascript"></script>
    <% end %>

    <% view = $views_config.view(session[:user], session[:user_gname], session[:default_view]) %>
    <% halt 500, "OpenNebula is unreachable" if view.nil? %>
    <script type="text/javascript">
      var csrftoken = '<%= session[:csrftoken] %>';
      var view = JSON.parse('<%= view.to_json %>')
      var available_views = JSON.parse('["<%=
          $views_config.available_views(session[:user], session[:user_gname]).join('","')
        %>"]')
      var all_views = JSON.parse('["<%=
          $views_config.get_all_views.join('","')
        %>"]')

      var config = {
        'user_config' : {
            'lang' : '<%= session[:lang] %>',
            'vnc_wss' : '<%= session[:vnc_wss] %>',
            'table_order' : '<%= session[:table_order] %>',
            'default_view' : '<%= session[:default_view] %>',
            'page_length' : '<%= session[:page_length] %>'
        },
        'system_config' : {
            'marketplace_url' : '<%= $conf[:marketplace_url] %>',
            'vnc_request_password' : <%= $conf[:vnc_request_password] || false %>,
            'vnc_proxy_port' : '<%= $vnc.proxy_port %>'
        },
        'view' : view,
        'available_views' : available_views,
        'all_views' : all_views,
        'user_id' : '<%= session[:user_id] %>',
        'user_gid' : '<%= session[:user_gid] %>',
        'display_name' : '<%= session[:display_name] %>',
        'zone_name' : '<%= session[:zone_name] %>',
        'zone_id' : '<%= session[:zone_id] %>',
        'vm_logos' : <%= logos_conf.to_json %>,
        'oned_conf' : <%= oned_conf.to_json %>,
        'support' : <%= support.to_json %>,
        'upgrade' : <%= upgrade.to_json %>
      };
    </script>



    <% if $conf[:env] == 'dev' %>
    <link href="css/app.css?v=<%= OpenNebula::VERSION %>" media="screen, projector, print" rel="stylesheet" type="text/css"></link>
    <% else %>
    <link href="css/app.min.css?v=<%= OpenNebula::VERSION %>" media="screen, projector, print" rel="stylesheet" type="text/css"></link>
    <% end %>
  </head>
  <body class="antialiased">
    <div id="top-row" class="row">
    </div>

    <div class="row">
      <div id="menu-wrapper" class="small-6 medium-3 large-2 columns sunstone-menu-content">
        <div id="menu" class="row sunstone-menu-body">
          <ul class="vertical menu" id="navigation" data-accordion-menu>
          </ul>
        </div>
      <div id="footer" class="text-center large-12 columns">
        <a href="http://opennebula.org" target="_blank">OpenNebula 5.2.0</a>
        <br> by
        <a href="http://OpenNebula.systems" target="_blank">OpenNebula Systems</a>.
      </div>
      </div>

      <div class="small-12 large-10 columns sunstone-content">
        <div class="sunstone-header">
        </div>
      </div>
      <div id="upload_progress_bars" class="large-10 columns end right">
      </div>
      <div id="loading" class="text-center">
        <span  id="loading-content">
          <i class="fa fa-5x fa-spinner fa-pulse"></i>
        </span>
      </div>
      <div class="large-12 columns" id="dialogs"></div>
    </div>


    <% if $conf[:env] == 'dev' %>
      <script src="bower_components/requirejs/require.js" data-main="app/main"></script>
    <% else %>
      <script src="dist/main.js?v=<%= OpenNebula::VERSION %>"></script>
    <% end %>
  </body>
</html>
